package capstoneproject.dudiachi.Main;


import java.util.List;

import capstoneproject.dudiachi.Main.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class WeekdayGridCellAdapter extends BaseAdapter {

	private List<String> listWD;
	private Context _context;
	private TextView weekday_cell;

	public WeekdayGridCellAdapter(Context context, List<String> listWD) {
		// TODO Auto-generated constructor stub
		super();
		this._context = context;
		this.listWD = listWD;
		
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return listWD.size();
	}

	@Override
	public String getItem(int position) {
		// TODO Auto-generated method stub
		return listWD.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		LayoutInflater inflater = (LayoutInflater) _context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View row = convertView;

        if (row == null) {

            row = new View(_context);

            // get layout from mobile.xml
            row = inflater.inflate(R.layout.weekdays_cell, null);

        } else {
            row = (View) convertView;
        }
        
        
        
//        String wdList = list.get(position);
        weekday_cell = (TextView)row.findViewById(R.id.weekday_cell);

        weekday_cell.setText(listWD.get(position));
            //SET TEXT AND BACKGROUND IMAGE HERE
            //gridView.setBackgroundResource(R.drawable.main_grid_item_import);

        
        


        return row;
	}

}
